//
//  UIImage+Category.m
//  TouchView
//
//  Created by HuangZuShu on 16/3/31.
//  Copyright © 2016年 Mac. All rights reserved.
//

#import "UIImage+ZSColor.h"

@implementation UIImage (ZSColor)
//根据颜色创建一个图片
+ (UIImage *)imageWithColor:(UIColor *)color rect:(CGRect)rect
{
    UIGraphicsBeginImageContext(rect.size);
    CGContextRef context = UIGraphicsGetCurrentContext();
    CGContextSetFillColorWithColor(context, [color CGColor]);
    CGContextFillRect(context, rect);
    
    UIImage *theImage = UIGraphicsGetImageFromCurrentImageContext();
    UIGraphicsEndImageContext();
    return theImage;
}
@end
